package com.zj.pojo;

import com.zj.config.YamlPropertySourceFactory;
import com.zj.config.YamlPropertySourceFactory2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
@ConfigurationProperties("user")
@PropertySource(value = "classpath:./data/user.yml",factory = YamlPropertySourceFactory2.class )

@Validated
public class User {
    @NotBlank
    private String userName;
    private int ageP;

    private Date birth;
    private List<String> hobbiesKK;
    private Map<String,Integer> houses;
    private Friend girlfriend;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public int getAgeP() {
        return ageP;
    }

    public void setAgeP(int ageP) {
        this.ageP = ageP;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public List<String> getHobbiesKK() {
        return hobbiesKK;
    }

    public void setHobbiesKK(List<String> hobbiesKK) {
        this.hobbiesKK = hobbiesKK;
    }

    public Map<String, Integer> getHouses() {
        return houses;
    }

    public void setHouses(Map<String, Integer> houses) {
        this.houses = houses;
    }

    public Friend getGirlfriend() {
        return girlfriend;
    }

    public void setGirlfriend(Friend girlfriend) {
        this.girlfriend = girlfriend;
    }

    @Override
    public String toString() {
        return "User{" +
                "userName='" + userName + '\'' +
                ", ageP=" + ageP +
                ", birth=" + birth +
                ", hobbiesKK=" + hobbiesKK +
                ", houses=" + houses +
                ", girlfriend=" + girlfriend +
                '}';
    }


    public static void main(String args[]){
        Map<String,Integer> kk=new HashMap<>();
        kk.put("安师大",20);
        System.out.println(kk);

    }
}
